if (!Date.now) {
    Date.now = function() { return new Date().getTime(); };
}



var currentTime = Date.now() || +new Date();
var qs = getQueryStrings();
var myParam = qs["id"]; 

loadVideoAds(myParam);

function getQueryStrings() { 
  var assoc  = {};
  var decode = function (s) { return decodeURIComponent(s.replace(/\+/g, " ")); };
  var queryString = location.search.substring(1); 
  var keyValues = queryString.split('&'); 

  for(var i in keyValues) { 
    var key = keyValues[i].split('=');
    if (key.length > 1) {
      assoc[decode(key[0])] = decode(key[1]);
    }
  } 

  return assoc; 
} 


//var qs = getQueryStrings();


//var first = getUrlVars()["me"];

function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    return vars;
}

// http://jquery-howto.blogspot.in/2009/09/get-url-parameters-values-with-jquery.html


function loadVideoAds(id){

//    loadJS('//html5.svnlabs.com/html5json.php?id='+myParam+'&t='+currentTime+'&_callback=processLast',false);
	loadJS('http://html5player.svnlabs.com/jdata/'+myParam+'.json?hash='+currentTime+'&_callback=processLast',false);
	
}

function loadJS(url,cache){
    //cache is true by default
    var s = document.createElement('script');
    s.type = 'text/javascript';
    s.src=url;
    if (cache==false) {
        s.src+='&jpt='+ (+new Date());
    }
    document.getElementsByTagName('head')[0].appendChild(s);
}


function processLast(feed){
	
	//console.log(feed.playlist.tracks.length);
	
	var str = '';
	
	var mp3s = feed.playlist.tracks[0].source;
	var mp3p = feed.playlist.tracks[0].artwork;
	var mp3t = feed.playlist.tracks[0].title;
	
	
	 looptrack = 0;
	  
/*	  var mp3s = 'http://www.svnlabs.com/mp3/svnlabs1.mp3';
	  var mp3p = 'http://html5.svnlabs.com/svnlabs-logo78.jpg';
	  var mp3t = 'SVN Labs Softwares1';*/
	  
      var _0x57b7=["\x6C\x6F\x61\x64","\x70\x6C\x61\x79","\x68\x74\x6D\x6C","\x23\x63\x75\x72\x72\x65\x6E\x74\x2D\x74\x72\x61\x63\x6B","\x73\x72\x63","\x61\x74\x74\x72","\x23\x63\x75\x72\x72\x65\x6E\x74\x2D\x70\x6C\x61\x79\x2D\x70\x69\x63","\x63\x72\x65\x61\x74\x65\x41\x6C\x6C","\x6C\x6F\x6F\x70","\x73\x65\x74\x74\x69\x6E\x67\x73","\x70\x72\x65\x76\x65\x6E\x74\x44\x65\x66\x61\x75\x6C\x74","\x70\x6C\x61\x79\x69\x6E\x67","\x72\x65\x6D\x6F\x76\x65\x43\x6C\x61\x73\x73","\x73\x69\x62\x6C\x69\x6E\x67\x73","\x61\x64\x64\x43\x6C\x61\x73\x73","\x63\x6C\x69\x63\x6B","\x6F\x6C\x20\x6C\x69","\x2E\x74\x72\x61\x63\x6B\x2D\x6E\x61\x6D\x65","\x70\x6C\x61\x79\x50\x61\x75\x73\x65","\x23\x70\x6C\x61\x79\x2D\x70\x61\x75\x73\x65","\x23\x50\x6C\x61\x79\x65\x72\x2D\x70\x72\x6F\x67\x72\x65\x73\x73\x62\x61\x72\x30\x31","\x6F\x66\x66\x73\x65\x74\x50\x61\x72\x65\x6E\x74","\x6F\x66\x66\x73\x65\x74\x4C\x65\x66\x74","\x63\x6C\x69\x65\x6E\x74\x58","\x6F\x66\x66\x73\x65\x74\x57\x69\x64\x74\x68","\x73\x6B\x69\x70\x54\x6F","\x63\x68\x61\x72\x43\x6F\x64\x65","\x6B\x65\x79\x43\x6F\x64\x65","\x6E\x65\x78\x74","\x6C\x69\x2E\x70\x6C\x61\x79\x69\x6E\x67","\x6C\x65\x6E\x67\x74\x68","\x66\x69\x72\x73\x74","\x70\x72\x65\x76","\x6C\x61\x73\x74","\x6B\x65\x79\x64\x6F\x77\x6E","\x76\x6F\x6C\x2D\x30","\x76\x6F\x6C\x2D\x31\x30","\x76\x6F\x6C\x2D\x32\x30","\x76\x6F\x6C\x2D\x33\x30","\x76\x6F\x6C\x2D\x34\x30","\x76\x6F\x6C\x2D\x35\x30","\x76\x6F\x6C\x2D\x36\x30","\x76\x6F\x6C\x2D\x37\x30","\x76\x6F\x6C\x2D\x38\x30","\x76\x6F\x6C\x2D\x39\x30","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64","\x2D","\x73\x70\x6C\x69\x74","\x64\x61\x74\x61\x2D\x76\x6F\x6C\x75\x6D\x65","\x73\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x6F\x6E\x63\x6C\x69\x63\x6B","\x67\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x73\x65\x74\x56\x6F\x6C\x75\x6D\x65"];$(function (){var _0xe0e7x1=audiojs[_0x57b7[7]]({trackEnded:function (){_0xe0e7x2[_0x57b7[0]](mp3s);_0xe0e7x2[_0x57b7[1]]();$(_0x57b7[3])[_0x57b7[2]](mp3t);$(_0x57b7[6])[_0x57b7[5]](_0x57b7[4],mp3p);} });var _0xe0e7x2=_0xe0e7x1[0];first=mp3s;_0xe0e7x2[_0x57b7[0]](first);$(_0x57b7[3])[_0x57b7[2]](mp3t);$(_0x57b7[6])[_0x57b7[5]](_0x57b7[4],mp3p);_0xe0e7x2[_0x57b7[9]][_0x57b7[8]]=false;$(_0x57b7[16])[_0x57b7[15]](function (_0xe0e7x3){_0xe0e7x3[_0x57b7[10]]();$(this)[_0x57b7[14]](_0x57b7[11])[_0x57b7[13]]()[_0x57b7[12]](_0x57b7[11]);_0xe0e7x2[_0x57b7[0]](mp3s);_0xe0e7x2[_0x57b7[1]]();} );$(_0x57b7[17])[_0x57b7[15]](function (_0xe0e7x3){$(_0x57b7[3])[_0x57b7[2]](mp3t);$(_0x57b7[6])[_0x57b7[5]](_0x57b7[4],mp3p);} );$(_0x57b7[19])[_0x57b7[15]](function (){_0xe0e7x2[_0x57b7[18]]();} );var _0xe0e7x4=$(_0x57b7[20]);leftPos=function (_0xe0e7x5){var _0xe0e7x6=0;if(_0xe0e7x5[_0x57b7[21]]){do{_0xe0e7x6+=_0xe0e7x5[_0x57b7[22]];} while(_0xe0e7x5=_0xe0e7x5[_0x57b7[21]]);;} ;return _0xe0e7x6;} ;$(_0x57b7[20])[_0x57b7[15]](function (_0xe0e7x3){var _0xe0e7x7=_0xe0e7x3[_0x57b7[23]]-leftPos(this);_0xe0e7x2[_0x57b7[25]](_0xe0e7x7/parseInt(this[_0x57b7[24]]));} );$(document)[_0x57b7[34]](function (_0xe0e7x3){var _0xe0e7x8=_0xe0e7x3[_0x57b7[26]]?_0xe0e7x3[_0x57b7[26]]:_0xe0e7x3[_0x57b7[27]];if(_0xe0e7x8==39){var _0xe0e7x9=$(_0x57b7[29])[_0x57b7[28]]();if(!_0xe0e7x9[_0x57b7[30]]){_0xe0e7x9=$(_0x57b7[16])[_0x57b7[31]]();} ;_0xe0e7x9[_0x57b7[15]]();} else {if(_0xe0e7x8==37){var _0xe0e7xa=$(_0x57b7[29])[_0x57b7[32]]();if(!_0xe0e7xa[_0x57b7[30]]){_0xe0e7xa=$(_0x57b7[16])[_0x57b7[33]]();} ;_0xe0e7xa[_0x57b7[15]]();} else {if(_0xe0e7x8==32){_0xe0e7x2[_0x57b7[18]]();} ;} ;} ;} );var _0xe0e7xb=[_0x57b7[35],_0x57b7[36],_0x57b7[37],_0x57b7[38],_0x57b7[39],_0x57b7[40],_0x57b7[41],_0x57b7[42],_0x57b7[43],_0x57b7[44]];for(var _0xe0e7xc=0,_0xe0e7xd=_0xe0e7xb[_0x57b7[30]];_0xe0e7xc<_0xe0e7xd;_0xe0e7xc++){var _0xe0e7x5=document[_0x57b7[45]](_0xe0e7xb[_0xe0e7xc]),_0xe0e7xe=_0xe0e7xb[_0xe0e7xc][_0x57b7[47]](_0x57b7[46])[1];_0xe0e7x5[_0x57b7[49]](_0x57b7[48],_0xe0e7xe/100);_0xe0e7x5[_0x57b7[50]]=function (_0xe0e7x3){_0xe0e7x2[_0x57b7[52]](this[_0x57b7[51]](_0x57b7[48]));_0xe0e7x3[_0x57b7[10]]();return false;} ;} ;} );
	  
	
	/*for (i = 0; i < feed.playlist.tracks.length; i++) {
	
	str += '<li>';
    str += '<a href="#" data-src="'+feed.playlist.tracks[i].source+'" title="'+feed.playlist.tracks[i].title+'" class="track-name" name="'+feed.playlist.tracks[i].artwork+'">'+feed.playlist.tracks[i].title+'</a>';
    str += '<p class="Title01">'+feed.playlist.tracks[i].artist+'</p>';
    str += '</li>';
	
	}*/
	
	//document.getElementById("tracks-list").innerHTML=str;
	
	
/*	var head1 = document.getElementsByTagName('head')[0];
	var script1 = document.createElement('script');
	script1.type = 'text/javascript';
	script1.src = 'core-new.js';
	head1.appendChild(script1);*/
	
	
}	



